<?php

namespace App\Http\Models;

use Illuminate\Database\Eloquent\Model;

class VipLevelExtraModel extends Model
{
	const ACTIVE_STATUS = 1;

	protected $connection = 'db_main';

	protected $table = 'wp_sdk_member_vip_level_extra';

	public $timestamps = false;

    public static function info($level_id, $product_id = null)
    {
        $where = ['status' => self::ACTIVE_STATUS];
        $where['level_id'] = $level_id;
        if($product_id) $where['product_id'] = $product_id;
        return self::where($where) -> first();
    }

    public static function getValue($field, $map = []){
        return self::where($map)->value($field);
    }
}

